﻿// Copyright (c) 2014 Jonathan Magnan (http://jonathanmagnan.com).
// All rights reserved (http://jonathanmagnan.com/icon-library).
// Licensed under MIT License (MIT) (http://ziconlibrary.codeplex.com/license).

namespace Z.GenerateIconProject.WinForm.BL
{
    public class Result
    {
        /// <summary>The message.</summary>
        public string Message;

        /// <summary>true to value.</summary>
        public bool Value;

        /// <summary>Constructor.</summary>
        /// <param name="value">true to value.</param>
        public Result(bool value)
        {
            Value = value;
        }

        /// <summary>Constructor.</summary>
        /// <param name="value">true to value.</param>
        /// <param name="message">The message.</param>
        public Result(bool value, string message)
        {
            Value = value;
            Message = message;
        }

        /// <summary>bool casting operator.</summary>
        /// <param name="this">this.</param>
        public static implicit operator bool(Result @this)
        {
            return @this.Value;
        }

        /// <summary>Result casting operator.</summary>
        /// <param name="value">true to value.</param>
        public static implicit operator Result(bool value)
        {
            return new Result(value);
        }
    }
}